<nz-card>
  <h1>基础信息</h1>
  <nz-row class="row">
    <span class="label required">活动类型</span>
    <nz-radio-group [(ngModel)]="formData.type" (ngModelChange)="typeChange()">
      <label nz-radio [nzValue]="1">满减</label>
      <label nz-radio [nzValue]="2">满折</label>
    </nz-radio-group>
  </nz-row>
  <nz-row class="row">
    <span class="label required">参与人限制</span>
    <nz-radio-group [(ngModel)]="formData.userType" (ngModelChange)="typeChange()">
      <label nz-radio [nzValue]="0">不限制</label>
      <label nz-radio [nzValue]="1">C端用户</label>
      <label nz-radio [nzValue]="2">B端用户</label>
    </nz-radio-group>
  </nz-row>
  <nz-row class="row">
    <span class="label required">生效时间</span>
      <nz-range-picker nzShowTime
                       nzFormat="yyyy-MM-dd HH:mm:ss"
                       [(ngModel)]="formData.time" nzAllowClear></nz-range-picker>
  </nz-row>

  <nz-row class="row">
    <span class="label required">活动名称</span>
    <input type="text" placeholder="仅内部可见" maxlength="30" nz-input [(ngModel)]="formData.name">
  </nz-row>
  <nz-row class="row">
    <span class="label required">前端标题</span>
    <input type="text" placeholder="请输入" maxlength="30" nz-input [(ngModel)]="formData.showCopy">
  </nz-row>
  <nz-row class="row">
    <span class="label selfTop">备注</span>
    <textarea
      nz-input
      [maxLength]="100"
      [(ngModel)]="formData.remark"
      placeholder="备注"
      [nzAutosize]="{ minRows: 2, maxRows: 6 }"
    ></textarea>
  </nz-row>

  <h1>
    优惠配置
    <!--满减-->
    <nz-input-number *ngIf="formData.type===1" nzPlaceHolder="请输入" [nzMin]="0"
                     nzPrecisionMode="cut" [nzPrecision]="2" [(ngModel)]="allDiscount"></nz-input-number>
    <!--满折-->
    <nz-input-group *ngIf="formData.type===2" nzAddOnAfter="折">
      <nz-input-number nzPlaceHolder="请输入" style="width: 100%" [nzMin]="0.01" [nzMax]="9.99" nzPrecisionMode="cut"
                       [nzPrecision]="2" [(ngModel)]="allDiscount"></nz-input-number>
    </nz-input-group>

    <button nz-button nzType="primary" (click)="allDiscountChange()">批量填写</button>
  </h1>
  <!--  满减表格-->
  <nz-table #minusTable [nzShowPagination]="false" nzBordered [nzData]="configTable"
            [nzPageSize]="9999" [nzScroll]="{ y: '640px' }">
    <thead>
    <tr>
      <th nzAlign="center" nzWidth="100px">序号</th>
      <th nzAlign="center">类型</th>
      <th nzAlign="center">平台</th>
      <th nzAlign="center">会员</th>
      <th nzAlign="center">套餐</th>
      <th nzAlign="center" nzWidth="160px">官方价格(元)</th>
      <th nzAlign="center" nzWidth="160px">平台价格(元)</th>
      <th nzAlign="center" nzWidth="160px">{{formData.type === 1 ? '减免额度（元）' : '折扣力度'}}</th>
      <th nzAlign="center" nzWidth="160px">最终价格(元)</th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of minusTable.data;let index=index">
      <td nzAlign="center">{{index + 1}}</td>
      <td nzAlign="center">{{ data.typeName }}</td>
      <td nzAlign="center">{{ data.brandName }}</td>
      <td nzAlign="center">{{ data.name }}</td>
      <td nzAlign="center">{{ data.spec }}</td>
      <td nzAlign="center">{{ data.originalPrice }}</td>
      <td nzAlign="center">
        <div *ngIf="data.priceB&&formData.userType!==1">B端：{{ data.priceB }}</div>
        <div *ngIf="data.price&&formData.userType!==2">C端：{{ data.price }}</div>
       </td>
      <td nzAlign="center">
        <!--满减-->
        <nz-input-number *ngIf="formData.type===1" nzPlaceHolder="请输入" [nzMin]="0" [nzMax]="formData.userType===1?data.price:data.priceB"
                         nzPrecisionMode="cut" [nzPrecision]="2"
                         [(ngModel)]="data.discount" (ngModelChange)="discountChange(data,$event)"></nz-input-number>
        <!--满折-->
        <nz-input-group *ngIf="formData.type===2" nzAddOnAfter="折">
          <nz-input-number nzPlaceHolder="请输入" style="width: 100%" [nzMin]="0.01" [nzMax]="9.99" nzPrecisionMode="cut"
                           [nzPrecision]="2"
                           [(ngModel)]="data.discount" (ngModelChange)="discountChange(data,$event)"></nz-input-number>
        </nz-input-group>
      </td>
      <td nzAlign="center">
        <div *ngIf="data.discount">
          <div *ngIf="data.priceB&&formData.userType!==1">B端：{{ data.finalPriceB }}</div>
          <div *ngIf="data.price&&formData.userType!==2">C端：{{ data.finalPrice }}</div>
        </div>
        <div *ngIf="!data.discount">-</div>
      </td>
    </tr>
    </tbody>
  </nz-table>
  <nz-row class="optionRow">
    <button nz-button nzType="default" routerLink="/recharge/rechargePromotion">取消</button>
    <button nz-button nzType="primary" (click)="publishP()">发布</button>
    <button nz-button nzType="primary" (click)="save()">保存</button>
  </nz-row>
</nz-card>
